package com.qd.common.panda.domain.entity.carpark;

import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.Optional;

/**
 * 门岗登录信息
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class CarParkDoorpostLoginDTO extends BaseQuery {

    /**
     * 主键
     */
    @NotBlank(message = "登录ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "登录ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String lid;
    /**
     * 操作时间
     */
    private LocalDateTime operatorTime;
    /**
     * 门岗ID
     */
    @NotBlank(message = "门岗ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "门岗ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String did;
    /**
     * 门岗ID显示
     */
    private String didDisplay;
    /**
     * 保安ID
     */
    @Size(max = 50, message = "操作人长度不能超过{max}位", groups = DefaultGroup.class)
    private String operator;
    /**
     * 保安机构ID
     */
    @Size(max = 50, message = "机构ID长度不能超过{max}位", groups = DefaultGroup.class)
    private String orgId;
    /**
     * 停车场
     */
    @NotBlank(message = "停车场不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "停车场长度不能超过{max}位", groups = DefaultGroup.class)
    private String parkId;
    /**
     * 登录门岗端状态
     */
    @Size(max = 20, message = "登录门岗端状态长度不能超过{max}位", groups = DefaultGroup.class)
    private String loginDoormanStatus;
    /**
     * 登录门岗端状态显示
     */
    private String loginDoormanStatusDisplay;

    /**
     * 门岗信息
     */
    private CarParkDoorpostDTO carParkDoorpost;

    @Override
    public void freeData() {
        this.lid = null;
        this.operatorTime = null;
        this.did = null;
        this.didDisplay = null;
        this.operator = null;
        this.orgId = null;
        this.parkId = null;
        this.loginDoormanStatus = null;
        this.loginDoormanStatusDisplay = null;
        Optional.ofNullable(carParkDoorpost).ifPresent(CarParkDoorpostDTO::freeData);
        super.freeData();
    }
}
